import { http } from '@/utils/request';
import type { Search } from '~/constants/types';




// 查看包裹列表
export function getPackage(orderSn:string) {
  return http.request({
    url: `/order/order/getPackage/${orderSn}`,
    method: "GET",
  });
}

/**
 * 获取订单详情
 * @param {*} params
 * @returns
 */
export function getOrderDetail(orderSn:string) {
  return http.request({
    url: `/order/order/${orderSn}`,
    method: 'GET',
  })
}

/**
 * 获取订单列表
 * @param {*} params
 * @returns
 */
export function getOrderList(params: Search) {
  return http.request({
    url: '/order/order',
    method: 'GET',
    params,
  })
}

/**
 * 获取我的评论列表
 * @param params
 * @returns {AxiosPromise}
 */
export function getComments(params: Search) {
  return http.request({
    url: "/member/evaluation",
    method: "GET",
    params,
  });
}

/**
 * 订单评论
 * @param params
 */
export function evaluation(params: any) {
  return http.request({
    url: "/member/evaluation",
    method: "POST",
    header: { "content-type": "application/x-www-form-urlencoded" },
    data: params,
  });
}

/**
 * 选择发票
 * @param params
 */
export function getReceipt(params: any) {
  return http.request({
    url: "/trade/carts/select/receipt",
    method: "GET",
    params
  })
}

/**
 * 选择发票
 * @param id
 */
export function getReceiptDetail(id: any) {
  return http.request({
    url: `/trade/receipt/${id}`,
    method: "GET",
  });
}